package com.example.myapplication.routertest

import androidx.compose.foundation.layout.Column
import androidx.compose.foundation.layout.fillMaxWidth
import androidx.compose.foundation.layout.padding
import androidx.compose.material3.Button
import androidx.compose.material3.Text
import androidx.compose.runtime.Composable
import androidx.compose.ui.Modifier
import androidx.compose.ui.unit.dp
import androidx.navigation.NavHostController

@Composable
fun Home(navController: NavHostController) {
    Column(
        modifier = Modifier
            .fillMaxWidth()
            .padding(top = 30.dp)
    ) {
        // 普通导航
        Button(
            onClick = {
                navController.navigate(Page1Route)
            }
        ) {
            Text(
                "go to page1",
            )
        }
        Button(
            onClick = {
                navController.navigate(Page2Route)
            }
        ) {
            Text(
                "go to page2",
            )
        }
        // 导航到弹框
        Button(
            onClick = {
                navController.navigate(Dialog1Route)
            }
        ) {
            Text(
                "go to dialog1",
            )
        }
        // 导航到嵌套路由
        Button(
            onClick = {
                navController.navigate(DetailRoute)
            }
        ) {
            Text(
                "go to detail",
            )
        }
        // 导航到路径参数
        Button(
            onClick = {
                navController.navigate(SafeRoute.User.path(123))
            }
        ) {
            Text(
                "go to user",
            )
        }
        // 导航到查询参数
        Button(
            onClick = {
                navController.navigate(StudentRoute("dilireba"))
            }
        ) {
            Text(
                "go to student",
            )
        }
    }
}